
var Employee = function () {

	var handleEmployee = function() {

		$('#EmployeeForm').validate({
			errorElement: 'span', //default input error message container
			errorClass: 'help-block', // default input error message class
			focusInvalid: false, // do not focus the last invalid input
			ignore: "",
			onkeyup: function(element) {
				$(element).valid();
			},
			onfocusout: function(element) {
				$(element).valid();
			},
			rules: {
				account: {
					required: true
				},
				password: {
					required: true,
					isPassword:true,
				},
				name: {
					required: true
				},
				idcard: {
					required: true,
					isIdCard :true,
				},
				sex: {
					required: true
				},
				tel: {
					required: true,
					isPhone: true,
				},
				address: {
					required: true
				},
				nativePlace: {
					required: true
				},
				birth: {
					required: true
				},
				email: {
					required: true
				},
				education: {
					required: true
				},
				entryTime: {
					required: true
				},
				maritalstatus: {
					required: true
				},
				post: {
					required: true
				},
				city: {
					required: true
				},
				storeId: {
					required: true
				},
				roleId: {
					required: true
				}
			},
			messages: {// custom messages for radio buttons and checkboxes
			},
			invalidHandler: function(event, validator) { //display error alert on form submit
				layer.alert("提交前请检查下输入信息！",{title:" "});
			},
			highlight: function(element) { // hightlight error inputs
				$(element).parent().addClass('has-error'); // set error class to the control group
			},
			success: function(label) {
				label.parent().removeClass('has-error');
				label.remove();
			},
			errorPlacement: function(error, element) {
				error.insertAfter(element);
			}
		});

	}
    
    return {
        //main function to initiate the module
        init: function () {
            handleEmployee();
        }

    };

}();